From 06b5b911aa249b74d3a300e846870f2da2b4d44b Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 7 Jun 2005 20:27:16 +0000 Subject: [PATCH] Updated pathaway and tef from Olaf. --- pathaway.c | 12 +++++++----- reference/pathaway-geo.loc | 38 ++++++++++++++++++++++++++++++++++++++ tef_xml.c | 5 +---- testo | 8 +++++--- 4 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 reference/pathaway-geo.loc diff --git a/pathaway.c b/pathaway.c index 35c23ef93..e3af37279 100644 --- a/pathaway.c +++ b/pathaway.c @@ -169,9 +169,10 @@ char *str_pool_getcpy(char *src, char *def) char *ppdb_fmt_float(const double val) { + char *c; char *str = str_pool_get(32); snprintf(str, 32, "%.8f", val); - char *c = str + strlen(str) - 1; + c = str + strlen(str) - 1; while ((c > str) && (*c == '0')) { *c = '\0'; @@ -188,6 +189,7 @@ char *ppdb_fmt_float(const double val) char *ppdb_fmt_degrees(char dir, double val) { + char *tmp; char *str = str_pool_get(32); int deg = abs(val); double min = 60.0 * (fabs(val) - deg); @@ -201,7 +203,7 @@ char *ppdb_fmt_degrees(char dir, double val) snprintf(str, 31, "%c%02d 000", dir, deg); snprintf(str + 6 - power, 24, "%.8f", min); - char *tmp = str + strlen(str) - 1; /* trim trailing nulls */ + tmp = str + strlen(str) - 1; /* trim trailing nulls */ while ((tmp > str) && (*tmp == '0')) { *tmp = '\0'; @@ -248,7 +250,7 @@ double ppdb_decode_coord(const char *str) int ppdb_decode_tm(char *str, struct tm *tm) { int i = 3; - int msec, d1, d2, d3, d4; + int msec, d1, d2, d3, d4, year; time_t tnow; struct tm now; @@ -272,7 +274,7 @@ int ppdb_decode_tm(char *str, struct tm *tm) now.tm_year += 1900; now.tm_mon++; - int year = (d1 * 100) + d2; + year = (d1 * 100) + d2; /* next code works for most, except for 19. and 20. of month */ /* for trouble use input date format - !!! ToDo !!! */ @@ -303,10 +305,10 @@ static int ppdb_read_wpt(const struct pdb *pdb_in, const struct pdb_record *pdb_ for (pdb_rec = pdb_in->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) { + int line = 0; waypoint *wpt_tmp = waypt_new(); data = (char *) pdb_rec->data; - int line = 0; str = csv_lineparse(data, ",", """", line++); while (str != NULL) { diff --git a/reference/pathaway-geo.loc b/reference/pathaway-geo.loc new file mode 100644 index 000000000..8e7a0194f --- /dev/null +++ b/reference/pathaway-geo.loc @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tef_xml.c b/tef_xml.c index 392cacb20..a5e2ac624 100644 --- a/tef_xml.c +++ b/tef_xml.c @@ -31,7 +31,6 @@ static char *deficon = NULL; static waypoint *wpt_tmp = NULL; static int item_count = -1; static int waypoints = 0; -static int mapsource = 0; static route_head *route = NULL; @@ -194,7 +193,7 @@ tef_list_end(const char *args, const char **unused) waypoint_final(); if (waypoints != item_count) { - fatal(MYNAME ": count waypoints differ to interlal ItemCount!\n"); + fatal(MYNAME ": waypoint count differs to internal \"ItemCount\"! (%d to %d)\n", waypoints, item_count); } } @@ -210,8 +209,6 @@ tef_item_start(const char *args, const char **attrv) wpt_tmp = waypt_new(); wpt_tmp->centiseconds = 0; - waypoints++; - if ((waypoints == 1) || (waypoints == item_count)) wpt_tmp->centiseconds++; diff --git a/testo b/testo index c4cfc3e26..7b931e87b 100755 --- a/testo +++ b/testo @@ -690,9 +690,11 @@ ${PNAME} -i geo -f geocaching.loc -o text -F ${TMPDIR}/text.out -o html -F ${TMP # # TourExchangeFormat tef (read only) # -rm -f ${TMPDIR}/tef_xms.mps -${PNAME} -r -i tef -f reference/route/tef_xml.sample.xml -o mapsource -F ${TMPDIR}/tef_xml.mps -bincompare ${TMPDIR}/tef_xml.mps reference/route/tef_xml.mps +rm -f ${TMPDIR}/tef_xml* +${PNAME} -r -i tef -f reference/route/tef_xml.sample.xml -o gpx -F ${TMPDIR}/tef_xml.sample.gpx +grep -v "